package com.itheima.d08_stream_getstream;

import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 目标：掌握获取Stream流的方式
 *  1.单列集合的Stream流
 *      Stream  stream()
 *  2.数组的Stream流
 *      Stream  Arrays.stream(数组)
 *      Stream  Stream.of(数组);
 */
public class Test {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Set<String> set = new HashSet<>();
        Map<String, Integer> map = new HashMap<>();
        int[] ages = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

        //1.List集合获取Stream流
        Stream<String> stream = list.stream();

        //2.Set集合获取Stream流
        Stream<String> stream1 = set.stream();

        //3.Map集合获取Stream流
        //先获取单例集合，在获取集合的Stream流
        Set<String> keys = map.keySet();
        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        Collection<Integer> values = map.values();

        Stream<String> stream2 = keys.stream();
        Stream<Map.Entry<String, Integer>> stream3 = entries.stream();
        Stream<Integer> stream4 = values.stream();


        //4.数组获取Stream流
        IntStream stream5 = Arrays.stream(ages);
        Stream<int[]> ages1 = Stream.of(ages);
    }
}














